;; Test file for set! expressions

;; Basic set! functionality
(define x 10)
(display "Initial value: ")
(display x)
(newline)

(set! x 20)
(display "After set! x 20: ")
(display x)
(newline)

;; set! with strings
(define message "hello")
(display "Initial message: ")
(display message)
(newline)

(set! message "world")
(display "After set! message \"world\": ")
(display message)
(newline)

;; set! with arithmetic expressions
(define result 0)
(display "Initial result: ")
(display result)
(newline)

(set! result (+ 5 3 2))
(display "After set! result (+ 5 3 2): ")
(display result)
(newline)

;; set! with variable references
(define a 5)
(define b 3)
(display "Initial a: ")
(display a)
(newline)

(set! a b)
(display "After set! a b: ")
(display a)
(newline)

;; Multiple set! operations
(define counter 0)
(display "Initial counter: ")
(display counter)
(newline)

(set! counter (+ counter 1))
(display "After increment: ")
(display counter)
(newline)

(set! counter (* counter 2))
(display "After multiply by 2: ")
(display counter)
(newline)

;; set! inside begin block
(define y 100)
(display "Initial y: ")
(display y)
(newline)

(begin
  (set! y 200)
  (display "Inside begin, after set! y 200: ")
  (display y)
  (newline)
  (set! y 300)
  (display "Inside begin, after set! y 300: ")
  (display y)
  (newline))

(display "Outside begin, final y: ")
(display y)
(newline)

;; Final values
(display "Final values:\n")
(display "x = ")
(display x)
(newline)
(display "message = ")
(display message)
(newline)
(display "result = ")
(display result)
(newline)
(display "a = ")
(display a)
(newline)
(display "counter = ")
(display counter)
(newline)
(display "y = ")
(display y)
(newline)